#ifndef  _RBTREE_H__
#define _RBTREE_H__
#include <iostream>
using namespace std;
#endif



class RBTree
{
    struct Node
    {
        Node* leftChild;
        Node* rightChild;
        Node* parent;
        bool isBlack;
        int data;
    };

public:
    RBTree();
    ~RBTree();
    void insert( int data );
    bool search( int data );

private:
    Node* getNode( int data );
    Node*& GrandFather(  Node * &p );
    Node*& Uncle(  Node* &p );
    void NodeDestory( Node* &p );
    void insertData( int data );
    void fixAfterInsert( Node* &p );
private:
    Node* root;
};